﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace GIAODIEN
{
    public partial class frmquanly : Form
    {
        public frmquanly()
        {
            InitializeComponent();
        }

        private void frmquanly_Load(object sender, EventArgs e)
        {

            if (bientoancuc.loaidn == 2)
            {
                nhanvienToolStripMenuItem1.Visible = false;
                sachToolStripMenuItem.Visible = false;
                tacgiaToolStripMenuItem.Visible = false;
            }
            else
                if (bientoancuc.loaidn == 3)
                {
                    phieumuonToolStripMenuItem.Visible = false;
                    docgiaToolStripMenuItem.Visible = false;
                    nhanvienToolStripMenuItem1.Visible = false;
                }


        }


        private void loạiSáchToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmloaisach frm = new frmloaisach();
            hienthiform(frm, bientoancuc.loaisach);
        }
        void hienthiform(Form frm, int giatri)
        {
            if (giatri == 1)
            {

                Form frmnv = Application.OpenForms[frm.Name.ToString()];
                frmnv.Activate();


            }
            else
            {


                frm.MdiParent = this;
                frm.Show();
            }

        }
        private void danhSáchSáchToolStripMenuItem_Click(object sender, EventArgs e)
        {

            frmthemsach frm = new frmthemsach();
            hienthiform(frm, bientoancuc.sach);
        }

        private void docgiaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmdocgia frm = new frmdocgia();
            hienthiform(frm, bientoancuc.docgia);
        }

        private void tácGiảToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmtacgia frm = new frmtacgia();
            hienthiform(frm, bientoancuc.tacgia);
        }

        private void phieumuonToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmphieumuon frm = new frmphieumuon();
            hienthiform(frm, bientoancuc.phieumuon);
        }

        private void danhSáchNvToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmthemnhanvien frm = new frmthemnhanvien();
            hienthiform(frm, bientoancuc.nv);
        }

        private void loạiNvToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmloainv frm = new frmloainv();
            hienthiform(frm, bientoancuc.loainv);
        }

        private void đăngXuấtToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
            Form frm = Application.OpenForms["frmdangnhap"];
            frm.Show();
        }

        private void tìmKiếmToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmtimkiem frm = new frmtimkiem();
            hienthiform(frm, bientoancuc.timkiem);
        }
    }
}